import api from '@/utils/request'

// 发起流程
export const newFlowInstance = (data: any) => {
    return api.post('/WorkFlow/instance/newInstance', data)
}

export const getCurrentFlowStatusBase64Url = (instanceId: string) => {
    return api.get('/WorkFlow/instance/getFlowStatusImage?instanceId=' + instanceId)
}

export const getWorkflowDefList = () => {
    return api.get('/WorkFlow/process/list')
}

export const deleteDeployByProcessId = (processId: any) => {
    return api.post('/WorkFlow/process/deleteDeployByProcessId?processId=' + processId)
}

export const getWorkflowInstanceListByProcessId = (processId: any) => {
    return api.get('/WorkFlow/instance/getByProcessId?processId=' + processId)
}

export const getAllWorkflowInstanceList = () => {
    return api.get('/WorkFlow/instance/getAllProcessInstance')
}

// 获取所有历史实例
export const getAllHistoryProcessInstanceList = () => {
    return api.get('/WorkFlow/instance/getAllHistoryProcessInstance')
}

// 根据 流程实例ID删除整个实例数据
export const deleteRunningWorkflowInstance = (instanceId: any) => {
    return api.post('/WorkFlow/instance/running/deleteByProcessInstanceId?processInstanceId=' + instanceId)
}

export const deleteHistoryWorkflowInstance = (instanceId: any) => {
    return api.post('/WorkFlow/instance/history/deleteByProcessInstanceId?processInstanceId=' + instanceId)
}